# -*- coding: utf8 -*-

from beaker.middleware import SessionMiddleware


class BlogSessionMiddleware(SessionMiddleware):
	
	def __init__(self, app):
		options = {
			'session.type': 'file',
			'session.cookie_expires': 120,
			'session.data_dir': './sessions',
			'session.auto': True
		}
		super(BlogSessionMiddleware, self).__init__(app, options)


def get_session(request):
	return request.environ.get('beaker.session')